package com.atguigu.gmall.item.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.ItemApiService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api/item")
public class ItemApiController {

    @Autowired
    private ItemApiService itemApiService;

    @GetMapping("/{skuId}")
    @ApiOperation("商品详情页汇总product模块中的数据")
    public Result getItemBySkuId(@PathVariable Long skuId){
        Map<String,Object>resultMap=new HashMap<>();
        resultMap=itemApiService.selectBySkuId(skuId);
        return Result.ok(resultMap);
    }

}
